package ReadWriteXML;
import java.util.ArrayList;


public class CResult {
	private int IDQuestion;
	private int type;
	private ArrayList<String> choice;
	private ArrayList<ArrayList<String>> pairChoice;
	
	//Contructor
	public CResult()
	{
		IDQuestion = 0;
		type = 0;
		choice = new ArrayList<String>();
		pairChoice = new ArrayList<ArrayList<String>>();
		
	}
	
	public void addChoice(String sChoice)
	{
		this.choice.add(sChoice);
	}
	
	public void removeChoice(String id)
	{
		int n = choice.size();
		for(int i = 0; i < n; i++)
		{
			if(choice.get(i).equals(id))
			{
				choice.remove(i);
				break;
			}
		}
	}
	public void removeChoice(int index)
	{
		choice.remove(index);
	}
	public boolean isVauleChoice(String id)
	{
		int n = choice.size();
		for(int i = 0; i < n; i++)
		{
			if(choice.get(i).equals(id))
			{
				return true;
			}
		}
		return false;
	}
	public void copyAllChoice(CResult res)
	{
		int n = res.getChoice().size();
		for(int i = 0; i < n; i++)
		{
			addChoice(res.getChoice().get(i));
		}
	}
	public void removeAllChoice()
	{
		int n = choice.size();
		for(int i = n-1; i >= 0; i--)
			choice.remove(i);
	}
	public void addPairChoice(ArrayList<String> pChoice)
	{
		this.pairChoice.add(pChoice);
	}
	//properties
	public void setIDQuestion(int iDQuestion) {
		IDQuestion = iDQuestion;
	}
	public int getIDQuestion() {
		return IDQuestion;
	}
	public void setType(int type) {
		this.type = type;
	}
	public int getType() {
		return type;
	}
	public void setChoice(ArrayList<String> choice) {
		this.choice = choice;
	}
	public ArrayList<String> getChoice() {
		return choice;
	}
	public void setPairChoice(ArrayList<ArrayList<String>> pairChoice) {
		this.pairChoice = pairChoice;
	}
	public ArrayList<ArrayList<String>> getPairChoice() {
		return pairChoice;
	}
}
